🎖️GitЯра🎖️
.github/agents/speckit.constitution.agent.md b307ceb5c24b98fa5c8a49fdf95e56eeaa4187bb (b307ceb5) Text, 8.23 KB
---
description: Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.
handoffs:
Tff7b72- label: Build Specification
agent: speckit.specify
Tc9d1d9 prompt: Implement the feature specification based on the updated constitution. I want to build...
Tc9d1d9---
Tc9d1d9## User Input
Ta5d6ff```Ta5d6fftext
$ARGUMENTS
Ta5d6ff```
You **MUST** consider the user input before proceeding (if not empty).
Tc9d1d9## Pre-Execution Checks
**Check for extension hooks (before constitution update)**:
Tff7b72- Check if Ta5d6ff`.specify/extensions.yml` exists in the project root.
Tff7b72- If it exists, read it and look for entries under the Ta5d6ff`hooks.before_constitution` key
Tff7b72- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
Tff7b72- Filter out hooks where Ta5d6ff`enabled` is explicitly Ta5d6ff`false`. Treat hooks without an Ta5d6ff`enabled` field as enabled by default.
Tff7b72- For each remaining hook, do **not** attempt to interpret or evaluate hook Ta5d6ff`condition` expressions:
Tff7b72- If the hook has no Ta5d6ff`condition` field, or it is null/empty, treat the hook as executable
Tff7b72- If the hook defines a non-empty Ta5d6ff`condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
Tff7b72- For each executable hook, output the following based on its Ta5d6ff`optional` flag:
Tff7b72- **Optional hook** (Ta5d6ff`optional: true`):
Ta5d6ff ```
## Extension Hooks
**Optional Pre-Hook**: {extension}
Command: `/{command}`
Description: {description}
Prompt: {prompt}
To execute: `/{command}`
```
Tff7b72- **Mandatory hook** (Ta5d6ff`optional: false`):
Ta5d6ff ```
## Extension Hooks
**Automatic Pre-Hook**: {extension}
Executing: `/{command}`
EXECUTE_COMMAND: {command}
Wait for the result of the hook command before proceeding to the Outline.
```
Tff7b72- If no hooks are registered or Ta5d6ff`.specify/extensions.yml` does not exist, skip silently
Tc9d1d9## Outline
You are updating the project constitution at Ta5d6ff`.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. Ta5d6ff`[PROJECT_NAME]`, Ta5d6ff`[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
**Note**: If Ta5d6ff`.specify/memory/constitution.md` does not exist yet, it should have been initialized from Ta5d6ff`.specify/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
Follow this execution flow:
Tff7b721. Load the existing constitution at Ta5d6ff`.specify/memory/constitution.md`.
Tff7b72- Identify every placeholder token of the form Ta5d6ff`[ALL_CAPS_IDENTIFIER]`.
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
Tff7b722. Collect/derive values for placeholders:
Tff7b72- If user input (conversation) supplies a value, use it.
Tff7b72- Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
Tff7b72- For governance dates: Ta5d6ff`RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), Ta5d6ff`LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
Tff7b72- Ta5d6ff`CONSTITUTION_VERSION` must increment according to semantic versioning rules:
Tff7b72- MAJOR: Backward incompatible governance/principle removals or redefinitions.
Tff7b72- MINOR: New principle/section added or materially expanded guidance.
Tff7b72- PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
Tff7b72- If version bump type ambiguous, propose reasoning before finalizing.
Tff7b723. Draft the updated constitution content:
Tff7b72- Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left).
Tff7b72- Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
Tff7b72- Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious.
Tff7b72- Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
Tff7b724. Consistency propagation checklist (convert prior checklist into active validations):
Tff7b72- Read Ta5d6ff`.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
Tff7b72- Read Ta5d6ff`.specify/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
Tff7b72- Read Ta5d6ff`.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
Tff7b72- Read each command file in Ta5d6ff`.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
Tff7b72- Read any runtime guidance docs (e.g., Ta5d6ff`README.md`, Ta5d6ff`docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
Tff7b725. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
Tff7b72- Version change: old → new
Tff7b72- List of modified principles (old title → new title if renamed)
Tff7b72- Added sections
Tff7b72- Removed sections
Tff7b72- Templates requiring updates (✅ updated / ⚠ pending) with file paths
Tff7b72- Follow-up TODOs if any placeholders intentionally deferred.
Tff7b726. Validation before final output:
Tff7b72- No remaining unexplained bracket tokens.
Tff7b72- Version line matches report.
Tff7b72- Dates ISO format YYYY-MM-DD.
Tff7b72- Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
Tff7b727. Write the completed constitution back to Ta5d6ff`.specify/memory/constitution.md` (overwrite).
Tff7b728. Output a final summary to the user with:
Tff7b72- New version and bump rationale.
Tff7b72- Any files flagged for manual follow-up.
Tff7b72- Suggested commit message (e.g., Ta5d6ff`docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
Formatting & Style Requirements:
Tff7b72- Use Markdown headings exactly as in the template (do not demote/promote levels).
Tff7b72- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
Tff7b72- Keep a single blank line between sections.
Tff7b72- Avoid trailing whitespace.
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
If critical info missing (e.g., ratification date truly unknown), insert Ta5d6ff`TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
Do not create a new template; always operate on the existing Ta5d6ff`.specify/memory/constitution.md` file.
Tc9d1d9## Post-Execution Checks
**Check for extension hooks (after constitution update)**:
Check if Ta5d6ff`.specify/extensions.yml` exists in the project root.
Tff7b72- If it exists, read it and look for entries under the Ta5d6ff`hooks.after_constitution` key
Tff7b72- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
Tff7b72- Filter out hooks where Ta5d6ff`enabled` is explicitly Ta5d6ff`false`. Treat hooks without an Ta5d6ff`enabled` field as enabled by default.
Tff7b72- For each remaining hook, do **not** attempt to interpret or evaluate hook Ta5d6ff`condition` expressions:
Tff7b72- If the hook has no Ta5d6ff`condition` field, or it is null/empty, treat the hook as executable
Tff7b72- If the hook defines a non-empty Ta5d6ff`condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
Tff7b72- For each executable hook, output the following based on its Ta5d6ff`optional` flag:
Tff7b72- **Optional hook** (Ta5d6ff`optional: true`):
Ta5d6ff ```
## Extension Hooks
**Optional Hook**: {extension}
Command: `/{command}`
Description: {description}
Prompt: {prompt}
To execute: `/{command}`
```
Tff7b72- **Mandatory hook** (Ta5d6ff`optional: false`):
Ta5d6ff ```
## Extension Hooks
**Automatic Hook**: {extension}
Executing: `/{command}`
EXECUTE_COMMAND: {command}
```
Tff7b72- If no hooks are registered or Ta5d6ff`.specify/extensions.yml` does not exist, skip silently
Served by rngit 1.5.4 - Generated in 0.06s